Getting your router to Tweet
Getting your router to Tweet
Original post-link # http://routing-bits.com/2010/01/20/tweeting-router/#more-1697
so an earlier post sharing a really neat geek trick is awesome, but how the hell does one go about configuring a router to tweet something? (if you not a programmer)
To do it, you would need the following:
- IOS image that supports EEM.
- A twitter account.
- A base64 encoded representation of you twitter account’s
- Bruno’s twitter script. Download tweet-policy.tcl here.
- The IP address of your nearest twitter server. (nslookup or dig will help you there)
The IOS obviously must support EEM.
Then once you have your twitter account, you need to encode your twitter account’s username:password to a base64 encoded representation. Could be done using this website. Example:
1
2 3 |
twitter-username:tweet-password
gives you dHdpdHRlci11c2VybmFtZTp0d2VldC1wYXNzd29yZA== |
Then copy the downloaded tweet-policy.tcl to your routers Flash:, either by TFTP or manually create it. I’ll show how to create the file manually in Flash:
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
Cisco-877#mkdir flash:eem
Create directory filename [eem]? Created dir flash:eem
Cisco-877#tclsh Cisco-877(tcl)#puts [open “flash:/eem/tweet-policy.tcl” w+] { +> #COPY AND PASTE THE CONTENTS OF ‘tweet-policy.tcl’
+> } <——DONT FORGET THE ‘}’ AFTER THE PASTE
Cisco-877(tcl)#tclquit
Cisco-877#dir flash:eem Directory of flash:/eem/
4 -rwx 4812 Jan 20 2010 15:04:43 +00:00 tweet-policy.tcl
23482368 bytes total (2254848 bytes free) <pre> |
Then configure the event manager policy settings:
1
2 3 4 |
event manager environment _tweet_b64 dHdpdHRlci11c2VybmFtZTp0d2VldC1wYXNzd29yZA==
event manager environment _tweet_ip 128.121.146.100 event manager directory user policy “flash:/eem” event manager policy tweet-policy.tcl type user |
The last thing left is to execute the EEM policy. This could be done manually or by specifying an EEM detector. Here is the manual way:
1 | event manager run tweet-policy.tcl |
All credit is due to Bruno Klauser for assisting and writing this neat script. Obviously be careful what you tweet to a public system. I won’t recommend tweeting your production networks syslog, unless you limiting the viewing access to your twitter account. I have another idea or two, that I will use this for. But more on that later.
Visit http://twitter.com/EASyDMI to see Bruno’s tweeting syslog.
PS, just a tip. Once you loaded the policy, if you change something in the policy file, you need to de-register and re-register the policy. Just changing the file is not sufficient, because IOS parses the policy and loads it into a protected memory space upon registration. The command below is an exec command which combines de-registration, tftp download and re-registration.
1 | event manager update |
This piece of writing presents clear idea in support of the new people of blogging, that genuinely how to do
running a blog.
Good article! We are linking to this particularly great article on our
website. Keep up the great writing.